/**
 * Created by linyanbin on 2018/9/30.
 */
$(function(){
    var queryString = window.location.search.substr(1);
    var articleId = queryString.split('=')[1];
    var loadOneUrl = '/campus/api/articles/' + articleId;
    var divEle = $('.composition_left');
    $.get(loadOneUrl, function(res){
        var templateHtml = '<input type="hidden" value="{{this.articleId}}"/><h4 class="composition_title">{{this.articleTitle}}</h4>' +
            '<p class="composition_p">' +
                '<span class="composition_author">{{this.user.username}}</span>' +
                '<span class="composition_post_time">{{this.createTime}}</span>' +
                '<span class="composition_view">（{{this.articleViewCount}}）</span>' +
                '<span class="composition_reply">（{{this.commentCount}}）</span>' +
            '</p>' +
            '<div class="composition_content">{{{this.articleContent}}}</div>' +
            '<div class="form-group">' +
            '<img src="img/a2.jpg" class="user_img" />' +
            '<input type="text" placeholder="说说你的看法" name="" class="user_post_input" />' +
            '<button class="user_post_button1">发表</button>' +
            '</div>';
        readTemplateAndPrepend(templateHtml, res.data, divEle);
        // 加载评论
        $('body').append('<script src="js/article/review/load_comment.js"></script>');
    }, "json");
});